home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
gfaxpert.lzh
/
START
/
GFASTART.GFA
(
.txt
)
next >
Wrap
GFA-BASIC Atari
|
1986-10-19
|
10KB
|
496 lines
' ********************
' *** GFASTART.GFA *** compile as *** GFASTART.PRG ***
' ********************
' *** this program runs in all resolutions
' *** 'Shell'-program for running compiled GFA-programs
' *** put GFASTART.PRG in the main directory
' *** programs should exit with CHAIN "\GFASTART.PRG"
' *** © Han Kempen (22-1-'90)
'
DEFWRD "a-z"
'
start$="\GFASTART.INF" ! last path saved here
'
CLS
' @check.boot ! check for boot-virus (not activated)
'
drive$=CHR$(65+GEMDOS(25)) ! current drive
'
bytes%=DFREE(0) ! slow on harddisk (unless FATSPEED installed)
current$=drive$+": "+STR$(bytes%)+" bytes free"
'
IF EXIST(start$)
OPEN "I",#1,start$ ! last accessed folder in GFASTART.INF
INPUT #1,path$
CLOSE #1
ELSE
path$=drive$+":\" ! main directory
ENDIF
'
SELECT XBIOS(4) ! examine resolution
CASE 2
high.res!=TRUE
scrn.col.max&=80
fac&=1
CASE 1
med.res!=TRUE
scrn.col.max&=80
fac&=2
CASE 0
low.res!=TRUE
scrn.col.max&=40
ENDSELECT
'
IF high.res!
VSETCOLOR 1,0
ELSE IF med.res!
@standard.med.colors
ELSE
@standard.low.colors
ENDIF
'
IF PEEK(&H444)<>0 ! not perfect
IF low.res! OR med.res!
SPOKE &HFF820A,252 ! NOT if you use a TV through a modulator !!
PRINT
PRINT " Vertical frequency now 60 Hz"
ENDIF
'
SPOKE &H444,0
PRINT
PRINT " Write Verify Test switched off"
'
IF VAL(RIGHT$(DATE$,2))<88 ! not perfect either
HIDEM
IF med.res! OR high.res!
LOCATE 1,9
PRINT @center$("START-SHELL")
DEFLINE 1,5
RBOX 22*8,10*16/fac&,58*8,15*16/fac&
LOCATE 25,12
@start.date.input
LOCATE 25,14
@start.time.input
DEFLINE 1,1
ELSE
LOCATE 1,9
PRINT @center$("STARTLOW-SHELL")
DEFLINE 1,3
RBOX 2*8,10*8,38*8,15*8
LOCATE 4,12
@start.date.input
LOCATE 4,14
@start.time.input
DEFLINE 1,1
ENDIF
SHOWM
ENDIF
ENDIF
'
IF high.res! OR med.res!
SELECT DPEEK(&H4A6) ! first check if two drives connected
CASE 1
drive$="A "
CASE 2
drive$="A B "
ENDSELECT
FOR n&=2 TO 15 ! now check other drives
IF BTST(BIOS(10),n&)
drive$=drive$+CHR$(n&+65)+" "
ENDIF
NEXT n&
bottom$="drives: "+drive$+" "+current$
ELSE
bottom$=current$
ENDIF
'
CLS
LOCATE 1,25
PRINT @center$(bottom$)
'
m$="Choose program <Cancel> = Quit"
REPEAT
@fileselect(path$+"*.PRG","",m$,file$)
UNTIL file$="" OR RIGHT$(file$)="\" OR RIGHT$(file$,4)=".PRG"
'
CLS
IF file$="" OR RIGHT$(file$)="\"
' *** user wants to quit
IF EXIST(start$)
KILL start$ ! kill GFASTART.INF
ENDIF
SYSTEM
ELSE
' *** user chose *.PRG-file
@parse.filename(file$,d$,p$,f$,e$)
path$=d$+":"+p$
OPEN "O",#1,start$
PRINT #1,path$ ! remember last path
CLOSE #1
CHAIN file$ ! start the program
ENDIF
'
' ------------------------------------------------------------------------------
'
DEFFN center$(text$)=SPACE$((scrn.col.max&-LEN(text$))/2)+text$
'
> PROCEDURE check.boot
' *** compute checksum of bootsector and warn user if bootsector executable
LOCAL drive&,buffer$,buffer%,sum%,n&,m$
PRINT " Checking boot-sector ..."
drive&=GEMDOS(&H19)
buffer$=SPACE$(512)
buffer%=VARPTR(buffer$)
~BIOS(4,0,L:buffer%,1,0,drive&) ! bootsector (0) of current drive in buffer
sum%=0
FOR n&=0 TO 255
ADD sum%,CARD{buffer%+n&*2}
NEXT n&
sum%=sum% AND &HFFFF
IF sum%=&H1234
m$="Bootsector|executable :|this could be|a boot-virus"
ALERT 3,m$,2," OK |STOP",k&
ENDIF
RETURN
' **********
'
> PROCEDURE get.path(VAR default.path$)
' *** return default path (current drive and folder)
' *** e.g. A:\GAMES\
LOCAL default.drive&,default.drive$,buffer$,buffer%
CLR default.path$
default.drive&=GEMDOS(&H19)
default.drive$=CHR$(default.drive&+65)
buffer$=SPACE$(64)
buffer%=VARPTR(buffer$)
VOID GEMDOS(&H47,L:buffer%,0)
default.path$=CHAR{buffer%}
IF default.path$<>""
default.path$=default.drive$+":"+default.path$+"\"
ELSE
default.path$=default.drive$+":\"
ENDIF
RETURN
' **********
'
> PROCEDURE standard.med.colors
' *** standard-colors for Medium resolution
LOCAL n&,col$,r&,g&,b&
RESTORE col.med.data
FOR n&=0 TO 3
READ col$
r&=VAL(LEFT$(col$))
g&=VAL(MID$(col$,2,1))
b&=VAL(RIGHT$(col$))
VSETCOLOR n&,r&,g&,b&
NEXT n&
'
col.med.data:
DATA 777,000,700,060
RETURN
' **********
'
> PROCEDURE standard.low.colors
' *** standard-colors for Low resolution
LOCAL n&,col$,r&,g&,b&
RESTORE col.low.data
FOR n&=0 TO 15
READ col$
r&=VAL(LEFT$(col$))
g&=VAL(MID$(col$,2,1))
b&=VAL(RIGHT$(col$))
VSETCOLOR n&,r&,g&,b&
NEXT n&
'
col.low.data:
DATA 777,000,700,060,007,005,520,050,555,111,077,053,707,505,550,770
RETURN
' **********
'
> PROCEDURE start.date.input
' *** input of date
' *** accepts different formats (day-month-year), e.g. :
' *** 1-6-'88 02-11-88 3.6.88 2/1/88 12 June 1988 9 Aug 88
LOCAL x&,y&,date.input$,ok!,day$,day&,month.input$,month$,n&,month!,month&,year$,year&
LOCAL new.date$
PRINT " Date (dd.mm.yy) : ";
x&=CRSCOL
y&=CRSLIN
ON ERROR GOSUB start.date.input.error
'
start.date.input:
' *** input of date
ok!=TRUE
FORM INPUT 18,date.input$
' *** day
day.len&=VAL?(date.input$)
IF day.len&>2
IF INSTR(date.input$,".")=2
day.len&=1
ELSE
IF INSTR(date.input$,".")=3
day.len&=2
ELSE
ok!=FALSE
ENDIF
ENDIF
ENDIF
day$=LEFT$(date.input$,day.len&)
day&=VAL(day$)
IF day&>31 OR day&<1
ok!=FALSE
ENDIF
' *** mmonth
month.input$=RIGHT$(date.input$,LEN(date.input$)-(day.len&+1))
month.len&=VAL?(month.input$)
IF month.len&=0
month$=LEFT$(month.input$,3)
month$=UPPER$(month$)
start.month.data:
DATA JAN,1,FEB,2,MAR,3,APR,4,MAY,5,JUN,6,JUL,7
DATA AUG,8,SEP,9,OCT,10,NOV,11,DEC,12
DIM date.input.month$(12),date.input.month&(12)
RESTORE start.month.data
FOR n&=1 TO 12
READ date.input.month$(n&),date.input.month&(n&)
NEXT n&
FOR n&=1 TO 12
IF date.input.month$(n&)=month$
month!=TRUE
month&=date.input.month&(n&)
ENDIF
NEXT n&
ERASE date.input.month$()
ERASE date.input.month&()
IF NOT month!
ok!=FALSE
ENDIF
ELSE
month&=VAL(month.input$)
ENDIF
IF month&>12 OR month&<1
ok!=FALSE
ENDIF
month$=STR$(month&)
IF (month&=4 OR month&=6 OR month&=9 OR month&=11) AND day&>30
ok!=FALSE
ENDIF
IF (month&=1 OR month&=3 OR month&=5 OR month&=7 OR month&=8 OR month&=10 OR month&=12) AND day&>31
ok!=FALSE
ENDIF
' *** year
year$=RIGHT$(date.input$,2)
IF VAL?(year$)<>2 OR INSTR(year$,".") OR VAL(year$)<88
ok!=FALSE
ENDIF
year&=VAL(year$)
IF month&=2
IF day&>28
IF (year& MOD 400=0) AND day&<>29
ok!=FALSE
ELSE
IF year& MOD 100=0 AND (year& MOD 400<>0)
ok!=FALSE
ELSE
IF (year& MOD 4=0) AND day&<>29
ok!=FALSE
ELSE
IF (year& MOD 4<>0)
ok!=FALSE
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
' *** print date
IF NOT ok!
PRINT CHR$(7);
PRINT AT(x&,y&);STRING$(LEN(date.input$)," ");
PRINT AT(x&,y&);"WRONG FORMAT !!";
PAUSE 50
PRINT AT(x&,y&);STRING$(18," ");
PRINT AT(x&,y&);"";
GOTO start.date.input
ENDIF
LET new.date$=day$+"."+month$+"."+year$
SETTIME TIME$,new.date$
ON ERROR
RETURN
' ***
> PROCEDURE start.date.input.error
' *** unexpected error
ok!=FALSE
ON ERROR GOSUB start.date.input.error
RESUME NEXT
RETURN
' **********
'
> PROCEDURE start.time.input
' *** input of time (seconds optional)
' *** <Return> = 00:00:00
' *** accepts different f